TON / TON_S - On-delay timer

 

This timer function block realizes an on-delay timing.

If the input IN changes from FALSE to TRUE, switching on is delayed for the time interval set at the input PT. After the delay time set at PT has elapsed, Q is set to TRUE. The already elapsed time is indicated at ET.

The function block is available as standard function block TON and safety-related function block TON_S.

TON

Parameter

Data types

Description

IN

BOOL

If a rising edge is detected, the on-delay timing is started.

PT

TIME

Preset time interval for the delay

Q

BOOL

TRUE if IN = TRUE and ET >= PT.

FALSE if IN = FALSE or ET < PT.

ET

TIME

Elapsed time interval

TON_S

Parameter

Data types

Description

IN

SAFEBOOL

If a rising edge is detected, the on-delay timing is started.

PT

SAFETIME

Preset time interval for the delay

Q

SAFEBOOL

TRUE if IN = TRUE and ET >= PT.

FALSE if IN = FALSE or ET < PT.

ET

SAFETIME

Elapsed time interval

NOTE:

Function blocks have to be instantiated. Like variables, instances have to be declared before they can be inserted in a code body. Instances must be unique within the POU. In the example, the instance name 'WATCHDOG_TIMER' is used.

Timing diagram

TON_TimeDia.gif

NOTE:

If the value applied at PT (Preset Time) is 0 or lower than the system's cycle time and a rising edge occurs at input IN, output Q is not set to TRUE until the next cycle.

Example for safety-related function block declaration TON_S

TON_Code.gif

Variables declarations in this example

TON_VarDecl.gif

NOTE:

If you want to use the standard function block TON in your code worksheet, you have to select the data type 'TON' for the function block instance in the local variables worksheet. Accordingly, the data types 'BOOL' and 'TIME' must be used instead of 'SAFEBOOL' and 'SAFETIME'.